	<?php echo form_open_multipart('adminproduct/addfunctions/'.$productid); ?>
		<link href="<?php echo $this->config->item('base_url').$this->config->item('template'); ?>styles/paging.css" media="screen" rel="stylesheet" type="text/css" />
		<fieldset>
			<label>Quản lý sản phẩm </label>	
			<section>
				<table>
				<thead>
					<tr> 
						<th>Ảnh đại diện</th>
						<th>Tên sản phẩm</th>
						<th>thể loại</th>
						<th>Kích hoạt</th>
						<th>giá</th>
						<th>sản phẩn quan tâm</th> 
						<th colspan="3">chỉnh sửa</th> 
					</tr>
				</thead>
				<tbody>
					<?php foreach($producttable as $row){?>
					<tr> 	
						<td><img src="<?php echo $this->config->item('base_url').$row->imgpath; ?>" width="50px" height="50px"></td>
						<td><?php print $row->productname ?></td>
						<td><?php print $row->catename ?></td>
						<td><?php print $row->active ?></td>
						<td><?php print $row->price ?></td> 
						<td><?php print $row->ishot ?></td> 
						<td><a href="<?php echo $this->config->item('base_url').'index.php/adminproperties/index/'.$row->cateid.'/'.$row->productid.'/0/1'; ?>">thuộc tính</a></td>
						<td><a href="<?php echo $this->config->item('base_url').'index.php/adminproduct/index/'.$row->productid.'/'.$index ?>">sửa</a></td>
						<td><a href="<?php echo $this->config->item('base_url').'index.php/adminproduct/delete/'.$row->productid.'/'.$index ?>">xóa</a></td>
					</tr>
					<?php } ?>
					<tr>
						<td colspan="9"><?php print $pagging ?></td>
					</tr> 
				</tbody>
				</table>
				&nbsp;<a href="<?php echo $this->config->item('base_url').'index.php/adminproduct/index/0/'.$index ?>" style="font-weight: bold;padding:10px 10px 10px 10px;text-decoration:none;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) inset;border-radius: 4px 4px 4px 4px;">thêm</a>
				<br /><br />
			</section>
			<section><label for="text_field" >Thể loại</label>
			<div>
				<select name="dropdown_cate1" id="dropdown_cate1" onchange="showUser();">
					<optgroup label="Thể loại mức 1">
						<?php foreach($cate1 as $row){ ?>
						<option value="<?php echo $row->cateid; ?>" <?php if($row->cateid==$cateidparent){echo "selected='selected'";} ?>><?php echo $row->catename; ?></option>
						<?php }?>
					</optgroup>
				</select>	
				<script type="text/javascript">
				function showUser()
				{
					str = $("#dropdown_cate1").val();
				if (window.XMLHttpRequest)
				  {// code for IE7+, Firefox, Chrome, Opera, Safari
				  xmlhttp=new XMLHttpRequest();
				  }
				else
				  {// code for IE6, IE5
				  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				  }
				xmlhttp.onreadystatechange=function()
				  {
				  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				    {
				      $("#dropdown_cate2").html(xmlhttp.responseText);
				    }
				  }
				xmlhttp.open("GET","<?php echo $this->config->item('base_url')?>index.php/adminproduct/changecate/"+str,true);
				xmlhttp.send();
				}
				</script>
				<select name="dropdown_cate2" id="dropdown_cate2">
					<optgroup label="Thể loại mức 2">
						<?php foreach($cate2 as $row){ ?>
						<option value="<?php echo $row->cateid; ?>"  <?php if($row->cateid==$cateid){echo "selected='selected'";} ?>><?php echo $row->catename; ?></option>
						<?php } ?>
					</optgroup>
				</select>
			</div>
			</section>
			<section><label for="text_field" >Tên sản phẩm</label>
				<div><input type="text" id="text_productname" name="text_productname"  value="<?php echo $productname; ?>" ></div>
			</section>
			<section><label for="textarea_auto">Mô tả<br><span>thông tin khái quát sản phẩm</span></label>
				<div><textarea id="textarea_descr" name="textarea_descr" data-autogrow="true"><?php echo $description;?></textarea>
				</div>
			</section>
			<section><label for="textarea_auto">Mô tả chi tiết sản phẩm<br><span>(W)hat (y)ou (s)ee (i)s (w)hat (y)ou (g)et</span></label>
				<div><textarea id="textarea_content" name="textarea_content" class="html" rows="12"><?php echo $content;?></textarea>
				</div>
			</section>
			<section>
				<label for="file_upload">Ảnh sản phẩm<br>
					<span>File có định dạng: jpg|jpeg|gif|png</span>
				</label>
				<div><input type="file" id="userfile" name="userfile"></div>
				<div><input type="text" id="text_imgpath" name="text_imgpath"  value="<?php echo $imgpath;?>"></div>
			</section>
			<section><label for="url">Url</label>
				<div><input id="url" name="url" type="url" placeholder="http://"  value="<?php echo $url;?>">
				</div>
			</section>
			<section><label for="url">Email</label>
				<div><input id="email" name="email" type="text" placeholder="email:abc@cde.com" value="<?php echo $email;?>">
				</div>
			</section>
			<section><label for="url">Số điện thoại</label>
				<div><input id="phone" name="phone" type="text" placeholder="(04)34 562 256" value="<?php echo $phone;?>">
				</div>
			</section>
			<section>
				<label>Trạng thái</label>
				<div>
					<input type="checkbox" id="check_active" name="check_active" <?php if($active>0){echo "checked='checked'";}?> ><label for="apples_check">Kích hoạt</label>
					<input type="checkbox" id="check_ishot" name="check_ishot" <?php if($ishot>0){echo "checked='checked'";}?> ><label for="bananas_check">Sản phẩm quan tâm</label>
				</div>
			</section>
			<section>
				<label>Giá</label>
				<div><input id="text_price" name="text_price" type="text" value="<?php echo $price;?>" placeholder="0" ><select name="dropdown_unit" id="dropdown_unit">
					<optgroup label="Đơn vị tính">
						<option value="VNĐ"  <?php if('VNĐ'==$unit){echo "selected='selected'";} ?>>VNĐ</option>
						<option value="USD"  <?php if('USD'==$unit){echo "selected='selected'";} ?>>USD</option>
					</optgroup>
				</select>
				</div>
			</section>
		</fieldset>
		<section>
			<?php echo form_submit('submit',"Cập nhật");  ?>
		</section>
<?php echo form_close();?>

